//
//  RTEmotionCollectionView.swift
//  Weibo
//
//  Created by Brisinga on 16/3/14.
//  Copyright © 2016年 Root. All rights reserved.
//

import UIKit

class RTEmotionCollectionView: UICollectionView {

    override init(frame: CGRect, collectionViewLayout layout: UICollectionViewLayout) {
        super.init(frame: frame, collectionViewLayout: layout)
        
        // 加载内部组件
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    // 加载内部组件
    private func setupUI() {
    
        self.showsHorizontalScrollIndicator = false
        
        self.pagingEnabled = true
        
        self.bounces = false
    
    }
    
    
    // 布局
    override func layoutSubviews() {
        
        
        var layout = self.collectionViewLayout as! UICollectionViewFlowLayout
        
        layout.itemSize = self.bounds.size
        
        layout.minimumInteritemSpacing = 0
        layout.minimumLineSpacing = 0
        
        layout.scrollDirection = .Horizontal
        
        super.layoutSubviews()
    }
}
